﻿using System;
using System.Collections.Generic;
using System.Text;
using TerminationCall.Core;
using System.Drawing;

namespace TerminationCall.Editor.Logic {

    public class PaintTile {

        private Layer _layer;
        private EditorToolManager _editorToolManager;

        public TileField OldTileField { get; set; }
        public TileField NewTileField { get; set; }
        public Point Point { get; set; }

        public PaintTile(Layer layer, EditorToolManager editorToolManager) {
            _layer = layer;
            _editorToolManager = editorToolManager;
        }

        public void UndoPaintTile() {

            if (Point.X < 0) {
                return;
            }
            if (Point.Y < 0) {
                return;
            }
            if (Point.X >= _layer.Fields.GetLength(0)) {
                return;
            }
            if (Point.Y >= _layer.Fields.GetLength(1)) {
                return;
            }

            _layer.Fields[Point.X, Point.Y].TileField = OldTileField;
        }

        public void RedoPaintTile() {

            if (Point.X < 0) {
                return;
            }
            if (Point.Y < 0) {
                return;
            }
            if (Point.X >= _layer.Fields.GetLength(0)) {
                return;
            }
            if (Point.Y >= _layer.Fields.GetLength(1)) {
                return;
            }

            _layer.Fields[Point.X, Point.Y].TileField = NewTileField;
        }

    }

}
